﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using STLGROUP.Layers.Presentations.FormBase;
using STLGROUP.Layers.Common;
using STLGROUP.Layers.DataAccessLayers;

namespace QuanLyBanHang
{
    /// <summary>
    /// CF008 Chuong Trinh Khuyen Mai - Giam Gia
    /// </summary>
    public partial class CF008 : frmCatalogBase
    {
        #region Constructors

        public CF008()
        {
            InitializeComponent();
            dgvChuongTrinhKhuyenMai.DataError += new DataGridViewDataErrorEventHandler(dgvChuongTrinhKhuyenMai_DataError);
        }

        #endregion

        #region Protected Methods

        protected override void LoadData()
        {
            this._bindingSource.DataSource = Cache.Context.KM_ChuongTrinhKhuyenMai;
            dgvChuongTrinhKhuyenMai.DataSource = _bindingSource;

            base.LoadData();
        }

        protected override void AddDataBinding()
        {
            txtTenChuongTrinhKhuyenMai.DataBindings.Add(Const.BIND_TEXT, _bindingSource, "TenChuongTrinh", true);
            dtiNgayBatDau.DataBindings.Add(Const.BIND_VALUE, _bindingSource, "NgayBatDau", true);
            dtiNgayKetThuc.DataBindings.Add(Const.BIND_VALUE, _bindingSource, "NgayKetThuc", true);
            txtGhiChu.DataBindings.Add(Const.BIND_TEXT, _bindingSource, "GhiChu", true);
            base.AddDataBinding();
        }

        protected override void AddNew()
        {
            base.AddNew();
            txtTenChuongTrinhKhuyenMai.Focus();
        }
        #endregion

        private void dgvChuongTrinhKhuyenMai_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            throw new NotImplementedException();
        } 

    }
}
